<template>
	<view class="container">
		<view>
			<uni-section title="核销记录" type="line">
				<view class="uni-container">
					<uni-table :loading="loading" border stripe emptyText="暂无更多数据">
						<uni-tr>
							<uni-th width="125" align="center">优惠券ID</uni-th>
							<uni-th width="125" align="center">时间</uni-th>
							<uni-th width="125" align="center">核销人</uni-th>
						</uni-tr>
						<uni-tr v-for="(item, index) in urls" :key="index">
							<uni-td align="center"> {{ item.uuid }} </uni-td>
							<uni-td align="center">
								<uni-dateformat :date="item.gmtCreate " format="yyyy-MM-dd"/>
							</uni-td>
							<uni-td align="center">{{ item.issuer }}</uni-td>

						</uni-tr>
					</uni-table>
					<view style="margin-top: 45rpx;">
						<uni-pagination show-icon :page-size="limit" :current="page" :total="total" @change="change" />
						</view>
			</view>
			</uni-section>
		</view>

	</view>

</template>
<script>
	export default {
		data() {
			return {
				urls: [],
				page: 1,
				limit: 13,
				total: 0,
				loading: false
			};
		},
		onLoad() {
			this.selectedIndexs = []
			this.getUrlsList(1)
		},


		methods: {
			// 分页触发
			change(e) {
				this.selectedIndexs.length = 0
				this.getUrlsList(e.current)
			},
			getUrlsList(pageSize) {
				const that = this
				that.loading = true
				that.page = pageSize
				that.$api.request('coupon', 'CancelAfterVerification', {
					page: pageSize,
					limit: that.limit
				}).then(res => {
					that.urls = res.data.items
					that.total = res.data.total
					that.loading = false
					console.log(res);
				})
			}


		}
	};
</script>

<style lang="scss">

</style>
